package com.ruoyi.hotel.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.hotel.domain.DishOrder;
import com.ruoyi.hotel.mapper.DishOrderMapper;
import com.ruoyi.hotel.service.IDishOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Service业务层处理
 * 
 * @author chen
 * @date 2022-05-03
 */
@Service
public class DishOrderServiceImpl implements IDishOrderService 
{
    @Autowired
    private DishOrderMapper dishOrderMapper;

    /**
     * 查询
     * 
     * @param id 主键
     * @return 
     */
    @Override
    public DishOrder selectDishOrderById(Long id)
    {
        return dishOrderMapper.selectDishOrderById(id);
    }

    /**
     * 查询列表
     * 
     * @param dishOrder 
     * @return 
     */
    @Override
    public List<DishOrder> selectDishOrderList(DishOrder dishOrder)
    {
        return dishOrderMapper.selectDishOrderList(dishOrder);
    }

    /**
     * 新增
     * 
     * @param dishOrder 
     * @return 结果
     */
    @Override
    public int insertDishOrder(DishOrder dishOrder)
    {
        dishOrder.setCreateTime(DateUtils.getNowDate());
        dishOrder.setCreateBy(SecurityUtils.getUserId()+"");
        return dishOrderMapper.insertDishOrder(dishOrder);
    }

    /**
     * 修改
     * 
     * @param dishOrder 
     * @return 结果
     */
    @Override
    public int updateDishOrder(DishOrder dishOrder)
    {
        dishOrder.setUpdateTime(DateUtils.getNowDate());
        return dishOrderMapper.updateDishOrder(dishOrder);
    }

    /**
     * 批量删除
     * 
     * @param ids 需要删除的主键
     * @return 结果
     */
    @Override
    public int deleteDishOrderByIds(Long[] ids)
    {
        return dishOrderMapper.deleteDishOrderByIds(ids);
    }

    /**
     * 删除信息
     * 
     * @param id 主键
     * @return 结果
     */
    @Override
    public int deleteDishOrderById(Long id)
    {
        return dishOrderMapper.deleteDishOrderById(id);
    }
}
